//
//  SlideshowModel.h
//

#import <Cocoa/Cocoa.h>

@class SSPathData;

enum 
{
	SS_SORT_NONE = 1,
	SS_SORT_DATE,
	SS_SORT_NAME,
};

@interface SlideshowModel : NSObject 
{
	NSString		*name;
	NSString		*filename;
	bool			autoShow;
	int				duration;

	// List of folders to include in this slideshow, each entry is an SSPathData.
	NSMutableArray	*folderList;

	// List of path name components to ignore, each entry is an SSPathData.
	NSMutableArray	*ignoreList;


	// Contains NSDictionary instances of the matching files found, use the SS* keys:
	// SSDate, SSName; filled by fileEnumerationThread
	NSMutableArray	*fileList;
	bool			didEnum;
	int				nextIndex;

	int				sortBy;
	bool			doNotRepeat;
}

- (id) initEmpty;
- (id) initWithDirectory:(NSString*) dirName  name:(NSString*) theName  
			incSub:(BOOL)includeSubFolders;
- (id) initWithFile:(NSString*) filename;
- (id) initWithModel:(SlideshowModel*) model;

- (BOOL) saveToFile:(NSString*) newName;


- (NSString*) filename;

- (NSString*) name;
- (void) setName:(NSString*) newName;

- (BOOL) autoShow;
- (void) setAutoShow:(BOOL) newAS;

// Duration is in seconds
- (int) duration;
- (void) setDuration:(int) newDur;

- (int) sortBy;
- (void) setSortBy:(int) newSortBy;

- (NSMutableArray*) folderList;
- (NSString*) folderListDescription;
- (void) setFolderList:(NSMutableArray*) newList;

- (NSMutableArray*) ignoreList;
- (NSString*) ignoreListDescription;
- (void) setIgnoreList:(NSMutableArray*) newList;

- (int) index;
- (int) fileCount;
- (NSString*) nextFile;
- (NSString*) previousFile;


// Force the thread to gather files
- (void) forceFileEnumeration;

@end

// Delegate methods
@interface NSObject (SlideshowModelDelegate)

- (void) foundFirstFile:(SlideshowModel*) sm;
- (void) completedEnumeration:(SlideshowModel*) sm;

@end


// Used to represent the data in both a FolderList as well as an IgnoreList.
@interface SSPathData : NSObject
{
	NSString	*name;
	bool		includeSubFolders;
	bool		enabled;
}

- (id) initWithName:(NSString*) nm ;

- (NSString*) name;
- (void) setName:(NSString*) newName;

- (bool) includeSubFolders;
- (void) setIncludeSubFolders:(bool) incl;

// Only valid for FolderList
- (bool) enabled;
- (void) setEnabled:(bool) enbl;

@end
